Update properties on an item
Parent Type: LearningStoreJob
Namespace: Microsoft.LearningComponents.Storage
Assembly: Microsoft.LearningComponents.Storage.dll
| C# |
|
public void UpdateItem ( ) |
id
Identifies the item being updated.
propertyValues
Property values to be updated. The key is the property name, and the value is the value to be placed in the property.
| Exception type | Condition |
| ArgumentNullException | id or propertyValues is a null reference. |
| Microsoft.LearningComponents.Storage.LearningStoreItemNotFoundException | The item was not found in the store. |
| System.InvalidOperationException | A property name passed in propertyValues doesn't exist on the item or a property value passed in propertyValues is not a valid value for the corresponding property. |
Steps required to update an item in the store:
This operation does not return anything as a result.
The following code updates the name of the user item with an Id of 50:
| C# |
// Create the property values
Dictionary<string,object> propertyValues = new Dictionary<string,object>();
propertyValues["Name"] = "John Doe";
// Create the job and add the "update properties" operation
LearningStoreJob job = store.CreateJob();
LearningStoreItemIdentifier id = new LearningStoreItemIdentifier("UserItem", 50);
job.UpdateItem(id, propertyValues);
// Execute the job
job.Execute();
|